package com.xique.park.api.factory;

import com.xique.common.core.domain.R;
import com.xique.park.api.RemoteParkInAndOutService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 进出记录客户端错误降级处理类
 *
 * @author WLD
 */
@Slf4j
@Component
public class RemoteParkInAndOutServiceFallbackFactory implements FallbackFactory<RemoteParkInAndOutService> {

    @Override
    public RemoteParkInAndOutService create(Throwable cause) {
        log.error("进出记录服务调用失败:{}", cause.getMessage());
        return () -> R.fail("定时删除进出记录失败" + cause.getMessage());
    }

}
